#ifndef SIMPLE_LOGGING_H_
#define SIMPLE_LOGGING_H_

#include <iostream>
#include <sstream>

using namespace std;

#define SIMPLE_LOG(level) if(level <= SLOG::GetCurrLevel()) SLOG::MsgPrinter(__FILE__, __LINE__, level).stream()
#define SLOG(level) SIMPLE_LOG( SLOG::level ## _LEVEL )

namespace SLOG {

typedef int LogLevel;

const LogLevel INFO_LEVEL = 1;
const LogLevel ERROR_LEVEL = 2;
const LogLevel DEBUG_LEVEL = 3;

// log level functions
LogLevel GetCurrLevel();
void SetInfoLevel();
void SetErrorLevel();
void SetDebugLevel();

// actual logger
class MsgPrinter {
public:
	MsgPrinter(const char* filename, int lineNo, LogLevel logLevel);
	~MsgPrinter();
	ostream& stream() { return logStream_; }
private:
	ostringstream logStream_;
};

}

#endif
